package upbeat.types;

/**
 *
 * This class holds all data associated with Cues.  {@link Conductor}s will generate Cues
 * that will then be passed to the {@link Manager} class.  The {@link Manager} will then
 * keep track of the Cues based on their time and give them to {@link Musician}s when
 * necessary.</br>
 * 
 * Cues have three pieces of data associated with them, a name, a time, and an additional
 * piece of data in the form of an integer.
 * 
 * @author Matt
 */

public class Cue implements Cloneable {
	private String name;
	private int time;
	public int data;
	
	/**
	 * Default constructor.  Sets the name to "" and the data to 0 and time to 1.
	 */
	public Cue() {
		this.name = new String("");
		this.data = 0;
		this.time = 1;
	}
	
	/**
	 * Constructor most likely to be used in Upbeat programs.  Initializes data
	 * and time both to 0.
	 * 
	 * @param name	the name of the Cue.
	 */
	public Cue( String name ) {
		setName( name );
		this.data = 0;
		this.time = 0;
	}
	
	/**
	 * Copy constructor.  Used by clone method to create a new Cue with different values
	 * @param c		the Cue to be copied
	 * 
	 * @see		#clone()
	 */
	public Cue( Cue c ) {
		this.setName(c.getName());
		this.setData(c.getData());
		this.setTime(c.getTime());
	}
	
	/**
	 * Used for creating a new Cue object with all the same values as this.
	 */
	public Cue clone(){
		return new Cue( this );
	}

	/**
	 * Sets the name.
	 * 
	 * @param name	value of the new name we're going to use.
	 */
	public void setName(String name) {
		this.name = new String( name );
	}

	/**
	 * Gets the name.
	 * 
	 * @return	copy of the name of this object.  Modifications to the copy will
	 * 			not affect the original.
	 */
	public String getName() {
		return new String(name);
	}
	
	/**
	 * Sets the time.
	 * 
	 * @param time	the new time that this Cue will occur.
	 */
	public void setTime(int time) {
		this.time = time;
	}

	/**
	 * Gets the time.
	 * 
	 * @return	the time this Cue needs to be executed.
	 */
	public int getTime() {
		return time;
	}

	/**
	 * Sets the data.
	 * 
	 * @param data	the data associated with this Cue.
	 */
	public void setData(int data) {
		this.data = data;
	}

	/**
	 * Gets the data.
	 * 
	 * @return	the integer piece of data associated with this Cue.
	 */
	public int getData() {
		return data;
	}
}

